home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 245 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.1 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: bgibbons@best.com (Bill Gibbons)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Make type_info name() distinct?
  5. Date: 02 Feb 1996 17:53:46 PST
  6. Organization: -
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <199602030146.RAA14333@shellx.best.com>
  9. References: <v01530500ad36a19a2831@[194.163.74.11]>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: Fri, 2 Feb 1996 17:46:33 -0800
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBVAwUBMRLAaky4NqrwXLNJAQHrOQH/T82PLhs5teBHfS1gCSeTsVTNfjL1XjHe
  14.     zjcx/ed2iFir3P6RBbVqOs/pp4UjBJTKBSlpRIJ2OwCL5S8Mk53sVg==
  15.     =UCgg
  16. Originator: austern@isolde.mti.sgi.com
  17.  
  18. In article <v01530500ad36a19a2831@[194.163.74.11]>,
  19. dirk@becker.adviser.com (Dirk Becker) wrote:
  20.  
  21. > Is there any detailed specification added to the name() member of
  22. > type_info objects or is it still just implementation dependent?
  23. > Why not ensure to have distinct names for different classes?
  24. > Could it be possible to have even distinct name()s for nested classes
  25. > bearing the same name but different enclosing classes?
  26. > What about classes with the same name but in different namespaces?
  27. > Or is "9.10 Nested type names" [class.nested.type] even applied to
  28. > RTTI names?
  29.  
  30. The original RTTI papers imply that the complete name, together with any
  31. qualification and/or template arguments, should be used.  For example:
  32.  
  33.     mytemplate<X>
  34.     mynamespace::outer::inner
  35.  
  36. But the papers did not explicitly specify how this was to be done, so the
  37. current draft leaves that implementation dependent.
  38.  
  39. I wrote a proposal for standardizing the names, but there was only
  40. lukewarm interest.  This is partly because there are some problems:
  41.  
  42.   * Function parameter types:
  43.  
  44.          does --typeid(void (*)(int,int).name()-- yield
  45.  
  46.                "void (*)(int,int)"
  47.           or   "void(*)(int, int)"
  48.           etc.
  49.          (possible answer - just specify a canonical form)
  50.  
  51.   * Template arguments:
  52.  
  53.          does --typeid(T<A,B>).name()-- yield
  54.  
  55.                "T<A,B>"
  56.           or   "T<A, B>"
  57.           etc.
  58.           (possible answer - just specify a canonical form)
  59.  
  60.   * How are unnamed types handled?  For example:
  61.  
  62.          struct { int x; } y;
  63.          typeid(y).name();
  64.          (possible answers - implementation dependent
  65.                              invented names based on ordinals)
  66.  
  67.   * How are local types handled?  For example:
  68.  
  69.          void f() { struct A { }; typeid(A).name(); }
  70.          void g() { struct A { }; typeid(A).name(); }
  71.  
  72.          Are these two names the same?
  73.          (possible answers - yes, they are the same
  74.                              implementation dependent
  75.                              invented names based on function signature
  76.                                but only unique for external functions)
  77.  
  78. There is some chance that some canonical form will be recommended
  79. in a non-normative annex in the standard.
  80.  
  81. -- 
  82. -- Bill Gibbons
  83.    bgibbons@best.com
  84. ---
  85. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  86.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  87.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  88.